<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.5,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no, email=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <!-- 删除苹果默认的工具栏和菜单栏 -->
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <!-- 设置苹果工具栏颜色 -->
    <meta name="format-detection" content="telphone=no, email=no" />
    <!-- 忽略页面中的数字识别为电话，忽略email识别 -->
    <!-- 启用360浏览器的极速模式(webkit) -->
    <meta name="renderer" content="webkit">
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
    <meta name="HandheldFriendly" content="true">
    <!-- 微软的老式浏览器 -->
    <meta name="MobileOptimized" content="320">
    <!-- uc强制竖屏 -->
    <meta name="screen-orientation" content="portrait">
    <!-- QQ强制竖屏 -->
    <meta name="x5-orientation" content="portrait">
    <!-- UC强制全屏 -->
    <meta name="full-screen" content="yes">
    <!-- QQ强制全屏 -->
    <meta name="x5-fullscreen" content="true">
    <!-- UC应用模式 -->
    <meta name="browsermode" content="application">
    <!-- QQ应用模式 -->
    <meta name="x5-page-mode" content="app">
    <!-- windows phone 点击无高光 -->
    <meta name="msapplication-tap-highlight" content="no">
    <title>工单录入</title>
    <link rel="stylesheet" href="{{asset('css/reset.css')}}">
    <link rel="stylesheet" href="{{asset('css/main.css')}}">
    <link rel="stylesheet" href="{{asset('css/index.css')}}">
    <link rel="stylesheet" href="{{asset('css/LCalendar.css')}}">
    <link rel="stylesheet" href="{{asset('css/yd_rl.css')}}" />
</head>
<body> 
    <!-- 公共头部 -->
    <div class="g2_head-bg">
        <!-- 返回上一层 -->
        <p class="g2_head_goback-bg fl">
            <a id="fanhui" href="javascript:history.back(-1)">
                <img src="{{asset('images/xky_icon0-1.png')}}" class="g2_head_goback_icon fl" alt="">
                <span class="g2_head_goback_del fl">返回</span>
            </a>
        </p>
        <p class="ym-tit fl">客户搜索</p>
        <span class="g2_head_goback_del fr khxz_color">新增</span>
        <span class="g2_head_goback_del fr gdlb_sx">筛选</span>
        <div class="cl"></div>
    </div>
    <div class="g2_head-bg2"></div>

    <!-- 客户搜索 -->
    <div class="khs2-bg" id="gdlr">
        <form action="" id="sousuo">
            <ul class="khs2">
                <li class="khs2_list">
                    <p class="khs2_tit fl">客户姓名</p>
                    <input type="text" name="customer" class="khs2_del fl" placeholder="请填写客户姓名" value="">
                    <div class="cl"></div>
                </li>
                <li class="khs2_list">
                    <p class="khs2_tit fl">客户电话</p>
                    <input type="text" name="phone" class="khs2_del fl" placeholder="请输入手机号" value="">
                    <div class="cl"></div>
                </li>
                <li class="khs2_list">
                    <p class="khs2_tit fl">身份证号</p>
                    <input type="text"  name="number" class="khs2_del fl" placeholder="请输入身份证号" value="">
                    <div class="cl"></div>
                </li>
                <input type="button" class="khx2_search-btn" value="搜索" readonly="readonly">
            </ul>
        </form>
    </div>

    <!-- 客户列表 -->
    <div class="khlb-bg" id="gdlr1">
        <ul class="khlb" id="kehu">
        </ul>
    </div> 
    <!-- 新增的客户录入 -->
    <div class="khlr-bg"  id="gdlr2">
        <form action="" id="customer">
            <ul class="grzx_xq-bg">
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户来源</p>
                        <span class="sewv fr">
                            <span class="sewvtop">
                                <input type="text" name="customer_laiyuan" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="" placeholder="请选择客户来源">
                                <em>
                                    <img src="{{asset('images/xky_icon9.png')}}">
                                </em>
                            </span>
                            <ul class="sewvbm">
                                <li>网站</li>
                                <li>转介绍</li>
                                <li>上门</li>
                                <li>电话销售</li>
                                <li>老客户</li>
                                <li>其他</li>
                            </ul>
                        </span>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p style="color:red;" class="grzx_xgname fl">客户姓名*</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="customer_name" placeholder="请输入客户姓名" class="grzx_xgsjhm" value="">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户年龄</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="customer_age" placeholder="请输入客户年龄" class="grzx_xgsjhm" value="">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">性别</p>
                    <p class="grzx_xgname_del fr">
                        <label class="grzx_sexinp-bg fr">
                            <input class="grzx_sexinp fr" name="customer_sex" type="radio" value="2" />
                            <span class="fr" style="margin-right:5%;">女</span>
                        </label>
                        <label class="grzx_sexinp-bg fr">
                            <input class="grzx_sexinp fr" checked="checked" name="customer_sex" type="radio" value="1" />
                            <span class="fr" style="margin-right:5%;">男</span>
                        </label>
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户电话</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" id="phone" name="customer_phone" placeholder="请输入客户联系电话" class="grzx_xgsjhm" value="">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户微信</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="customer_weixin" placeholder="请输入客户微信" class="grzx_xgsjhm" value="">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户QQ</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="customer_qq" placeholder="请输入客户QQ" class="grzx_xgsjhm" value="">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">客户邮箱</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="customer_email" placeholder="请输入电子邮箱" class="grzx_xgsjhm" value="">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">身份证号</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="customer_sfz" placeholder="请输入身份证号" class="grzx_xgsjhm" value="">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p style="color:red;" class="grzx_xgname fl">客户类别*</p>
                        <span class="sewv fr">
                            <span class="sewvtop">
                                <input type="text" name="customer_type" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="" placeholder="请选择客户类别">
                                <em>
                                    <img src="{{asset('images/xky_icon9.png')}}">
                                </em>
                            </span>
                            <ul class="sewvbm">
                                <li>单位</li>
                                <li>个人</li>
                            </ul>
                        </span>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p style="color:red;" class="grzx_xgname fl">单位名称*</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="customer_danwei" placeholder="请输入单位名称" class="grzx_xgsjhm" value="">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">备注</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="customer_beizhu" placeholder="请输入工单备注" class="grzx_xgsjhm" value="">
                    </p>
                    <div class="cl"></div>
                </li>
            </ul>
            <!-- 按钮 -->
            <div class="grzx_cz_btns">
                <input type="reset" class="grzx_cx_btn fl" value="撤 销">
                <input type="button" id="formcustomer" class="grzx_tj_btn fr" value="提 交">
                <div class="cl"></div>
            </div>
        </form>
    </div>

    <!-- 工单录入 -->
    <div class="gdlr-bg"  id="gdlr3">
        <form action="" id="formgongdan">
            <input type="hidden" name="order_customerid" id="customer_id" value="">
            <p class="gdx2_tit">工单信息</p>
            <ul class="grzx_xq-bg">
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">旅游类型</p>
                        <span class="sewv fr">
                            <span class="sewvtop">
                                <input type="text" id='lvyouleixing' name="order_didian" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="" placeholder="请选择旅游类型">
                                <em>
                                    <img src="{{asset('images/xky_icon9.png')}}">
                                </em>
                            </span>
                            <ul class="sewvbm">
                                @foreach($type as $vo)
                                    <li>{{$vo->title}}</li>
                                @endforeach
                            </ul>
                        </span>
        
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">旅游地点</p>
                        <span class="sewv fr">
                            <span class="sewvtop">
                                <input type="text" class="lvyd2" id="didian" name="order_didian2" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="" placeholder="请选择旅游地点">
                                <em>
                                    <img src="{{asset('images/xky_icon9.png')}}">
                                </em>
                            </span>
                            <ul class="sewvbm" id="lvyoudidian">
                                
                            </ul>
                        </span>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">旅游线路</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name='order_xianlu' placeholder="请输入旅游线路" class="grzx_xgsjhm" value="">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">标签</p>
                        <span class="sewv fr">
                            <span class="sewvtop">
                                 <input type="text" name="order_lvyouleibie" style="height:12vw;border:none;font-size:1.6rem;width:88%;" value="" placeholder="请选择标签">
                                <em>
                                    <img src="{{asset('images/xky_icon9.png')}}">
                                </em>
                            </span>
                            <ul class="sewvbm">
                                @foreach($biaoqian as $vo)
                                    <li>{{$vo->name}}</li>
                                @endforeach
                            </ul>
                        </span>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list" style="position:relative;">
                    <p class="grzx_xgname fl">出发时间</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="order_lvyoudate" id="start_date" class="start_date" readonly="readonly" />
                        <img src="{{asset('images/xky_icon8.png')}}" class="grzx_xgdate" alt="">
                    </p>
                    <div class="cl"></div>
                </li>
                <li class="grzx_xq_list">
                    <p class="grzx_xgname fl">工单备注</p>
                    <p class="grzx_xgname_del grzx_xgsjhm-bg fr">
                        <input type="text" name="order_beizhu" class="grzx_xgsjhm" placeholder="请输入备注详情" value="">
                    </p>
                    <div class="cl"></div>
                </li>
            </ul>
            <p class="gdx2_tit"></p>
            <!-- 按钮 -->
            <div class="grzx_cz_btns">
                <input type="reset" class="grzx_cx_btn fl" value="撤 销">
                <input type="button" id="gongdanluru"  class="grzx_tj_btn fr" value="提 交">
                <div class="cl"></div>
            </div>
        </form>
    </div>
    <!-- 遮罩 -->
    <!-- loading 小圆圈 -->
    <div class="z2_loading-bg" style="width:100%;height:100%;background:rgba(255,255,255,0.6);position:fixed;;left:0;top:0;">
        <img src="{{asset('images/loading1.gif')}}" style="width:10%;position:fixed;left:0;right:0;top:0;bottom:0;margin:auto;" alt="">
    </div>
    <!-- loadning对号 -->
    <div class="duihao" style="width:100%;height:100%;position:fixed;;left:0;top:0;display:none;">
        <img src="{{asset('images/duihao.png')}}" style="width:10%;position:fixed;left:0;right:0;top:0;bottom:0;margin:auto;" alt="">
    </div>
    <!-- 提示信息 --> 
    <p id="tishi" style="display:none;position:fixed;left:0;right:0;top:0;bottom:0;margin:auto;width:94%;height:8vw;line-height:8vw;color:#fff;font-size:1.6rem;text-align:center;background:rgba(0,0,0,0.5);border-radius:4px;"></p>
    <!-- 下拉框遮罩-->
    <div class="xlz2-bg" style="width:100%;height:100%;position:fixed;left:0;top:0;background:transparent;z-index:-1;"></div>
    <script src="{{asset('js/jquery.min.js')}}"></script>
    <script src="{{asset('js/fastclick.min.js')}}"></script>
</body>
    <script src="{{asset('js/LCalendar.js')}}" type="text/javascript" charset="utf-8"></script>
    <script src="{{asset('js/index.js')}}" type="text/javascript" charset="utf-8"></script>
    <script>
        $(function () {
            FastClick.attach(document.body);
        });
        // 旅游地点点击事件
        $(function(){  
            $("#didian").click(function(){
                var lvyouleixing=$("#lvyouleixing").val();
                $.ajax({
                    url:"{{url('lvyouleixing')}}",
                    type:'get', //GET
                    async:false,    //或false,是否异步
                    data:{'lvyouleixing':lvyouleixing},
                    dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                    success:function(data){ 
                        var html="";
                        $.each(data,function(i,item){
                            html+="<li>"+item+"</li>";
                    　　});
                        $("#lvyoudidian").html(html);
                        $("#lvyoudidian li").click(function(){
                            // alert($(this).html())
                            $("#didian").val($(this).html());
                            $("#lvyoudidian").css('display','none');
                        })
                    }, 
                })
            }); 
        })
        // 工单录入按钮点击事件
        $(function(){  
            $("#gongdanluru").click(function(){
                if($("input[name='order_didian']").val()==''){
                    $("#tishi").html('旅游类型必须选择');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='order_didian2']").val()==''){
                    $("#tishi").html('旅游地点必须选择');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='order_xianlu']").val()==''){
                    $("#tishi").html('旅游线路必须输入');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='order_lvyouleibie']").val()==''){
                    $("#tishi").html('标签必须选择');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='order_lvyoudate']").val()==''){
                    $("#tishi").html('出发时间必须选择');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='order_beizhu']").val() ==''){
                    $("#tishi").html('工单备注必须输入');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else{
                    var d = {};
                    var t = $('#formgongdan').serializeArray();
                    $.each(t, function() {
                      d[this.name] = this.value;
                    });
                    var data=JSON.stringify(d);
                    $.ajax({
                        url:"{{url('xiadan/tianjia')}}",
                        type:'post', //GET
                        async:false,    //或false,是否异步
                        data:{'_token':'{{csrf_token()}}','data':data},
                        dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                        beforeSend:function(){
                            console.log('发送前');
                            $('.z2_loading-bg').show();
                        },
                        success:function(data){
                            if(data=="false"){
                                $('.z2_loading-bg').hide();
                                $("#tishi").html('录入失败');
                                $("#tishi").stop(true, true).fadeIn('fast');
                                $("#tishi").fadeOut(1500);
                            }else{
                                $('.z2_loading-bg').hide();
                                $('.duihao').show();
                                $('.duihao').hide(1000);
                                location.href ="{{url('order')}}";
                            }
                        }, 
                        complete:function(){
                            // location.hash = 'gdgl1';
                            // $("#gdgl1").show();
                            // $("#gdgl2").hide();
                            // $('.ym-tit').html('工单列表');
                            // $('.z2_loading-bg').hide();
                            // $('.duihao').show();
                            // $('.duihao').hide(1000);
                        }
                    })
                }
            }); 
        })
        // 客户录入点击事件
        $(function(){  
            $("#formcustomer").click(function(){
                if($("input[name='customer_laiyuan']").val()==''){
                    $("#tishi").html('客户来源必须选择');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='customer_name']").val()==''){
                    $("#tishi").html('客户姓名必须输入');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='customer_phone']").val() !='' && $("input[name='customer_phone']").val().length !=11){
                    $("#tishi").html('客户电话必须为11位');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='customer_sfz']").val() !='' && $("input[name='customer_sfz']").val().length !=18){
                    $("#tishi").html('身份证号码必须18位');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='customer_type']").val()==''){
                    $("#tishi").html('客户类别');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else if($("input[name='customer_danwei']").val()==''){
                    $("#tishi").html('单位名称必须输入');
                    $("#tishi").stop(true, true).fadeIn('fast');
                    $("#tishi").fadeOut(1500);
                }else{
                    var d = {};
                    var t = $('#customer').serializeArray();
                    $.each(t, function() {
                      d[this.name] = this.value;
                    });
                    var data=JSON.stringify(d);
                    // alert(data);
                    $.ajax({
                        url:"{{url('xiadan/customer')}}",
                        type:'post', //GET
                        async:false,    //或false,是否异步
                        data:{'_token':'{{csrf_token()}}','data':data},
                        dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                        beforeSend:function(){
                            console.log('发送前');
                            $('.z2_loading-bg').show();
                        },
                        success:function(data){
                            if(data=="false"){
                                $('.z2_loading-bg').hide();
                                $("#tishi").html('录入失败');
                                $("#tishi").stop(true, true).fadeIn('fast');
                                $("#tishi").fadeOut(1500);
                            }else if(data=="phone"){
                                $('.z2_loading-bg').hide();
                                $("#tishi").html('客户已存在');
                                $("#tishi").stop(true, true).fadeIn('fast');
                                $("#tishi").fadeOut(1500);
                            }else{
                                $("#kehu").html("<li class='khlb_list'><p class='khlb_name fl'>"+data.customer_name+"</p><p class='khlb_iphone fl'>"+data.customer_phone+"</p><p class='khlb_gs fl'>"+data.customer_sfz+"</p><p style='display:none;'>"+data.id+"</p><input type='button' class='khlb_xd-btn fr' value='下单'><div class='cl'></div></li>");
                                // 下单点击事件
                                $('.khlb_xd-btn').click(function () {
                                    var id=$('.khlb_xd-btn').prev().html();
                                    $("#customer_id").val(id);
                                    location.hash = 'gdlr3';
                                    $("#gdlr").hide();
                                    $("#gdlr1").hide();
                                    $("#gdlr2").hide();
                                    $("#gdlr3").show();
                                    $('.khxz_color').hide();
                                    $('.ym-tit').html('工单录入');
                                })
                            }
                        }, 
                        complete:function(){
                            location.hash = 'gdlr1';
                            // $("#fanhui").attr('href',"{{url('/xiadan')}}");
                            $("#gdlr").hide();
                            $("#gdlr1").show();
                            $("#gdlr2").hide();
                            $("#gdlr3").hide();
                            $('.khxz_color').show();
                            $('.ym-tit').html('客户列表');
                            $('.z2_loading-bg').hide();
                            $('.duihao').show();
                            $('.duihao').hide(1000);
                        }
                    })
                }
            }); 
        })
        window.onload = function (event) {
            location.hash = 'gdlr';
            $("#gdlr").show();
            $("#gdlr1").hide();
            $("#gdlr2").hide();
            $("#gdlr3").hide();
            $(".z2_loading-bg").hide();
            
        }
        $(window).on('hashchange', function (e) {
            var id = location.hash.substr(1);
            // $(".main").hide()
            $("#" + id).show()

            if (id == "gdlr1") {
                $("#gdlr").hide();
                $("#gdlr1").show();
                $("#gdlr2").hide();
                $("#gdlr3").hide();
                $('.khxz_color').show();
                $('.ym-tit').html('客户列表');
            } else if (id == "gdlr2") {
                $("#gdlr").hide();
                $("#gdlr1").hide();
                $("#gdlr2").show();
                $("#gdlr3").hide();
                $('.khxz_color').show();
                $('.ym-tit').html('新增客户录入');
            } else if (id == "gdlr3") {
                $("#gdlr").hide();
                $("#gdlr1").hide();
                $("#gdlr2").hide();
                $("#gdlr3").show();
                $('.khxz_color').hide();
                $('.ym-tit').html('工单录入');
            }
        })
        // 客户搜索点击事件
        $('.khx2_search-btn').click(function () {
            if($("input[name='phone']").val()!='' && $("input[name='phone']").val().length !=11){
                $("#tishi").html('手机号码必须11位数字');
                $("#tishi").stop(true, true).fadeIn('fast');
                $("#tishi").fadeOut(1500);
            }else if($("input[name='number']").val()!='' && $("input[name='number']").val().length !=18){
                $("#tishi").html('身份证号码必须18位');
                $("#tishi").stop(true, true).fadeIn('fast');
                $("#tishi").fadeOut(1500);
            }else{
                var d = {};
                var t = $('#sousuo').serializeArray();
                $.each(t, function() {
                  d[this.name] = this.value;
                });
                var data=JSON.stringify(d);
                $.ajax({
                    url:"{{url('xiadan/sousuo')}}",
                    type:'post', //GET
                    async:false,    //或false,是否异步
                    data:{'_token':'{{csrf_token()}}','data':data},
                    dataType:'json',    //返回的数据格式：json/xml/html/script/jsonp/text
                    beforeSend:function(){
                        $('.z2_loading-bg').css('display','block');
                    },
                    success:function(data){
                        var html="";
                        if(data=="false"){
                            location.reload(); 
                        }else{
                            $.each(data,function(i,item){
                                $("#kehu").append("<li class='khlb_list'><p class='khlb_name fl'>"+item.customer_name+"</p><p class='khlb_iphone fl'>"+item.customer_phone+"</p><p class='khlb_gs fl'>"+item.customer_sfz+"</p><p style='display:none;'>"+item.id+"</p><input type='button' class='khlb_xd-btn fr' value='下单'><div class='cl'></div></li>");
                        　　});
                            // 下单点击事件
                            $('.khlb_xd-btn').click(function () {
                                var id=$('.khlb_xd-btn').prev().html();
                                $("#customer_id").val(id);
                                location.hash = 'gdlr3';
                                $("#gdlr").hide();
                                $("#gdlr1").hide();
                                $("#gdlr2").hide();
                                $("#gdlr3").show();
                                $('.khxz_color').hide();
                                $('.ym-tit').html('工单录入');
                            })
                        }
                    }, 
                    complete:function(){
                        location.hash = 'gdlr1';
                        // $("#fanhui").attr('href',"{{url('/xiadan')}}");
                        $("#gdlr").hide();
                        $("#gdlr1").show();
                        $("#gdlr2").hide();
                        $("#gdlr3").hide();
                        $('.khxz_color').show();
                        $('.ym-tit').html('客户列表');
                        $('.z2_loading-bg').hide();
                    }
                })
            }
            
        })
        $('.khxz_color').click(function () {
            location.hash = 'gdlr2';
            $("#gdlr").hide();
            $("#gdlr1").hide();
            $("#gdlr2").show();
            $("#gdlr3").hide();
            $('.khxz_color').show();
            $('.ym-tit').html('新增客户录入');
        })
        $("#")
    </script>
    <script type="text/javascript">
        var calendar = new LCalendar();
        calendar.init({
            'trigger': '#start_date', //标签id
            'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
            'minDate': (new Date().getFullYear() - 3) + '-' + 1 + '-' + 1, //最小日期
            'maxDate': (new Date().getFullYear() + 3) + '-' + 12 + '-' + 31 //最大日期
        });

        var calendar = new LCalendar();
        calendar.init({
            'trigger': '#end_date', //标签id
            'type': 'date', //date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择,
            'minDate': (new Date().getFullYear() - 3) + '-' + 1 + '-' + 1, //最小日期
            'maxDate': (new Date().getFullYear() + 3) + '-' + 12 + '-' + 31 //最大日期
        });
                //      $(function() {
                //          $('#start_date').date();
                //          $('#end_date').date();
                //      });
        $('.date_btn').click(function () {
            alert(111);
            $('.grzx_xgdate').css('display', 'block');
        })

    </script>
</html>